Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save cookie banner cookie across subdomains #98332

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

draganescu
Copy link

@draganescu draganescu commented Jan 14, 2025

Fixes ##94071

Proposed Changes

  • Add a domain to the cookie setting for the setTrackingPrefs util so that cookies are also applying to subdomains of that domain

Why are these changes being made?

  • Because previously setTrackingPrefs omitted to set any domain and this resulted in only the current domain being set for the cookie.

Testing Instructions

  1. Have a local calypso running under wpcalypso.wordpress.com
  2. Checkout this PR
  3. Edit your development config and set cookie_banner to true
  4. Restart the calypso watcher
  5. Have a sandboxed website
  6. Visit wpcalypso.wordpress.com and delete the sensitive_pixel_options cookie via developer tools
  7. Refresh
  8. You should see the cookie banner
  9. Accept all
  10. Make sure your selected website is the sandboxed one (via hosting options)
  11. Visit Settings > Media (this takes you out of Calypso)
  12. You should not the cookie banner

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

…bdomains too. This is inline with how a8c-analytics plugin does it in on the server. This enables the same cookie to be read by both systems when the user visits wp-admin after having the cookie set by a Calypso UI.
@draganescu
Copy link
Author

I wonder if there should be some condition around the name of the domain and around setting it. There are calypso instances running in other domains, that's for sure.

@draganescu draganescu self-assigned this Jan 14, 2025
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~4 bytes added 📈 [gzipped])

name                 parsed_size           gzip_size
entry-subscriptions        +24 B  (+0.0%)       +4 B  (+0.0%)
entry-stepper              +24 B  (+0.0%)       +4 B  (+0.0%)
entry-main                 +24 B  (+0.0%)       +4 B  (+0.0%)
entry-login                +24 B  (+0.0%)       +4 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • happy-blocks
  • help-center
  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/cookie-persistence on your sandbox.

@draganescu draganescu requested a review from mmtr January 14, 2025 12:19
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 14, 2025
@scruffian scruffian changed the title Save cookie banner cookie acroess subdomains Save cookie banner cookie across subdomains Jan 15, 2025
@getdave
Copy link
Contributor

getdave commented Jan 15, 2025

Have a local calypso running under wpcalypso.wordpress.com

That's not my local calypso URL for development. To avoid ambiguity could you link to docs on how you recommend doing this? 🙏

Edit your development config and set cookie_banner to true

Would it be possible for you to be specific about the "config" are you referring to here?

Make sure your selected website is the sandboxed one (via hosting options)

What is "hosting options"?


Without diving deep into the Issue what is the problem being solved here? I think it's that we don't want the cookie banner to show up again when we move from Calypso to WPAdmin URLs. Am I right? It would be super helpful to have a little more context to aid in testing outside of the specific scenario outlined here 🙏

@draganescu
Copy link
Author

Without diving deep into the Issue what is the problem being solved here?

I am never a fan of repeating the issue content 😂 The problem is: for a user visiting LOHP or simple site admin, the cookie banner appears again even if it is dismissed in calypso, whenever a user lands on a wp-admin page. The solution is to make sure there is a domain wildcard recorded in the cookie set by calypso.

That's not my local calypso URL for development.

In PCYsg-5YE-p2 there are instructions about setting up Calypso to run under .wordpress.com domain locally. For this a reverse proxy to the calypso.localhost default works good enough.

be specific about the "config"

This config: fbhepr%2Skers%2Spnylcfb%2Spbasvt%2Sqrirybczrag.wfba%3Se%3Q6q17p7o9-og

What is "hosting options"?

Screenshot 2025-01-15 at 16 53 29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants